import Layout from '@/layout/index.vue'
//对外暴露配置路由(常量路由):全部用户都可以访问到的路由
export const constantRoute = [
  {
    //登录
    path: '/login',
    component: () => import('@/views/login/index.vue'),
    name: 'Login',
    meta: {
      title: '登录', //菜单标题
      hidden: true //代表路由标题在菜单中是否隐藏  true:隐藏 false:不隐藏
    }
  },
  {
    //登录成功以后展示数据的路由
    path: '/',
    component: Layout,
    name: 'Dashboard',
    redirect: '/dashboard',
    children: [
      {
        path: '/dashboard',
        component: () => import('@/views/home/index.vue'),
        name: 'DashboardIndex',
        meta: {
          title: '首页',
          affix: true,
          icon: 'dashboard'
        }
      }
    ]
  },
  {
    path: '/awaitList',
    component: Layout,
    name: 'awaitList',
    redirect: '/awaitList/index',
    children: [
      {
        path: '/awaitList/index',
        component: () => import('@/views/awaitList/index.vue'),
        name: 'awaitListIndex',
        meta: {
          title: '待入库商品管理',
          icon: 'banner'
        }
      }
    ]
  },
  {
    path: '/wareHousing',
    component: Layout,
    name: 'wareHousing',
    redirect: '/wareHousing/index',
    children: [
      {
        path: '/wareHousing/index',
        component: () => import('@/views/wareHousing/index.vue'),
        name: 'wareHousing',
        meta: {
          title: '库存管理',
          icon: 'news',
          roles: ['admin']
        }
      }
    ]
  },
  {
    path: '/check',
    component: Layout,
    name: 'checkIndex',
    redirect: '/check/index',
    children: [
      {
        path: '/check/index',
        component: () => import('@/views/check/index.vue'),
        meta: {
          title: '复检管理',
          icon: 'check'
        }
      }
    ]
  },
  {
    path: '/outBound',
    component: Layout,
    name: 'outBoundIndex',
    redirect: '/outBound/index',
    children: [
      {
        path: '/outBound/index',
        component: () => import('@/views/outBound/index.vue'),
        meta: {
          title: '出库管理',
          icon: 'outBound'
        }
      }
    ]
  },
  {
    path: '/fail',
    component: Layout,
    name: 'failIndex',
    redirect: '/fail/index',
    children: [
      {
        path: '/fail/index',
        component: () => import('@/views/fail/index.vue'),
        meta: {
          title: '入库失败商品',
          icon: 'fail'
        }
      }
    ]
  },
  {
    path: '/404',
    component: () => import('@/views/404/index.vue'),
    name: '404',
    meta: {
      title: '404',
      hidden: true
    }
  },
  {
    path: '/:pathMatch(.*)*',
    component: () => import('@/views/404/index.vue'),
    meta: {
      title: '任意路由',
      hidden: true
    }
  }
]

//异步路由
export const asnycRoute = [
  {
    path: '/users',
    component: Layout,
    name: 'Users',
    redirect: '/users/index',
    children: [
      {
        path: '/users/index',
        name: 'UsersIndex',
        component: () => import('@/views/auth/index.vue'),
        meta: { title: '身份管理管理', icon: 'user', roles: ['admin'] }
      }
    ]
  }
]
